package com.junzerg.tooltip.component;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.junzerg.tooltip.entity.dao.ConfigDao;
import com.junzerg.tooltip.service.IConfigService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author pengjz <br>
 * @version 1.0 <br>
 * @description ConfigComponent <br>
 * @date 2022/4/10 15:01 <br>
 */
@Component
public class ConfigComponent {

    @Resource
    private IConfigService configService;

    public List<String> getConvAnnouncement() {
        return configService.list(
                new QueryWrapper<ConfigDao>().eq(
                        "config_key", "conv_announcement"
                )
        ).stream().map(ConfigDao::getConfigValue).collect(Collectors.toList());
    }
}
